import request from '@/utils/request'

// 获取公交/地铁线路列表
export function getTransitLines(type) {
  return request({
    url: '/api/transit/lines',
    method: 'get',
    params: { type }
  })
}

// 获取线路站点列表
export function getStations(type, lineNumber) {
  return request({
    url: '/api/transit/stations',
    method: 'get',
    params: { type, lineNumber }
  })
}

// 获取车辆位置
export function getVehicleLocation(type, lineNumber) {
  return request({
    url: '/api/transit/vehicle-location',
    method: 'get',
    params: { type, lineNumber }
  })
}

// 获取预计到达时间
export function getEstimatedArrivalTime(type, lineNumber, station) {
  return request({
    url: '/api/transit/estimated-arrival',
    method: 'get',
    params: { type, lineNumber, station }
  })
}

// 开始乘车
export function startTransit(data) {
  return request({
    url: '/api/transit/start',
    method: 'post',
    data
  })
}

// 结束乘车
export function endTransit(recordId) {
  return request({
    url: `/api/transit/end/${recordId}`,
    method: 'post'
  })
}

// 获取乘车记录列表
export function getTransitRecords(params) {
  return request({
    url: '/api/transit/records',
    method: 'get',
    params
  })
}

// 获取乘车记录详情
export function getTransitRecordById(id) {
  return request({
    url: `/api/transit/records/${id}`,
    method: 'get'
  })
}

// 获取待支付记录
export function getPendingPayments() {
  return request({
    url: '/api/transit/pending-payments',
    method: 'get'
  })
}

// 计算乘车费用
export function calculateFare(data) {
  return request({
    url: '/api/transit/calculate-fare',
    method: 'post',
    data
  })
} 